package com.buaa.aimall.Utils;

import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.buaa.aimall.Utils.Enum.StatusCode;

import java.lang.reflect.Type;

public class StatusCodeSerializer implements ObjectSerializer {
    @Override
    public void write(JSONSerializer serializer, Object object, Object fieldName, Type firldType, int features) {
        serializer.write(StatusCode.valueOf(object.toString()).getCode());
    }
}
